from excel.phylum_analysis import get_average_data, get_phylum
from matplotlib import pyplot
import numpy as np
# import matplotlib.font_manager

from signal import signal, SIGPIPE, SIG_DFL, SIG_IGN
signal(SIGPIPE, SIG_IGN)


# my_font = matplotlib.font_manager.FontProperties(fname="C:\华文楷体.ttf")   # 指定字体

data = get_average_data()
phylum = get_phylum()
pyplot.figure(figsize=(80, 50), dpi=100)
y = data[0]
x = np.arange(len(y))
y2 = data[3]
y3 = data[6]
y4 = data[9]


x_label = phylum
bar_width = 0.2
pyplot.barh(x, y, bar_width, color='red', label='0')
pyplot.barh(x+bar_width, y2, bar_width, color='green', left=0, label='100')
pyplot.barh(x+2*bar_width, y3, bar_width, color='blue', left=0, label='1000')
pyplot.barh(x-bar_width, y2, bar_width, color='yellow', label='2000')

pyplot.ylabel('phylum')
pyplot.xlabel('quantity')
pyplot.yticks(x+bar_width/4, x_label)
pyplot.axis()
pyplot.legend()
pyplot.grid(alpha=0.4)
# pyplot.title('第一天不同浓度下各门类的数量', fontproperties = my_font)
pyplot.show()
